package com.xiaoran.goods20013.controller;


import com.xiaoran.commonapi.entity.Rst;
import com.xiaoran.goods20013.entity.XrGoodsType;
import com.xiaoran.goods20013.service.IXrGoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author xiaoRan
 * @since 2022-02-25
 */
@RestController
@RequestMapping("/xr-goods-type")
public class XrGoodsTypeController {
    @Autowired
    IXrGoodsTypeService gtS;
    @Autowired
    Rst rst;

    @GetMapping("/getList")
    public Object getList(Long storeid) {
        List<XrGoodsType> data = gtS.getList(storeid);
        if (data.isEmpty()) {
            return rst.success(null);
        } else {
            return rst.success(data);
        }
    }

    @PostMapping("/addOne")
    public boolean addOne(XrGoodsType data) {
        return gtS.addOne(data) == 1;
    }
}
